package com.mytijian.task.selector;

import com.mytijian.task.zookeeper.ZookeeperRegistryCenter;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.recipes.cache.TreeCacheEvent;
import org.apache.curator.framework.recipes.cache.TreeCacheListener;

public class SelectorClient4 {
    public static void main(String[] args) throws InterruptedException {
        ZookeeperRegistryCenter registryCenter = new ZookeeperRegistryCenter(null);
        registryCenter.init();
        registryCenter.persistEphemeral("/test", "");
        registryCenter.addListener("/test", new TreeCacheListener() {
            @Override
            public void childEvent(CuratorFramework client, TreeCacheEvent event) throws Exception {
                if (event.getType() == TreeCacheEvent.Type.NODE_REMOVED) {
                    int i = 0;

                }
            }
        });
        Thread.sleep(100000);
        registryCenter.destory();
    }
}
